package houtai.controller;

import houtai.service.DashBoardService;
import houtai.vo.DashBoardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("dashboard")
public class DashBoardController {
    @Autowired
    private DashBoardService dashBoardService;

    @GetMapping("summary")
    public ResponseEntity<DashBoardVo> queryDashBoard(){
        try {
            DashBoardVo dashBoardVo = dashBoardService.queryDashBoard();
            return ResponseEntity.ok(dashBoardVo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }
}
